<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="include/peizhi.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="${ctx}">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
        
        <title>后台管理中心</title> 
		<link rel="stylesheet" href="${ctx}/css/pintuer.css" /> 
		<link rel="stylesheet" href="${ctx}/css/admin.css" /> 
        <script type="text/javascript" src="${ctx}/js/jquery-1.9.1.min.js"></script>
        <script type="text/javascript" src="${ctx}/js/pagehoutai.js"></script>
<style type="text/css">
</style>
    </head>

  	<body style="background-color:#f2f9fd;"> 
	  <jsp:include page="include/header.jsp" flush="true"/>
  <div class="admin"> 
	<div class="panel admin-panel margin-top" id='maint'>
	  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>增加内容</strong></div>
	  <div class="body-content">
	    <form method="post" class="form-x" action="${ctx}/column/addCoumn" onsubmit="return check()">   
	      <input type="hidden" name="id" value="${resources.id}">
	      <div class="form-group">
	        <div class="label">
	          <label>栏目名称：</label>
	        </div>
	        <div class="field">
	          <input type="text" class="input w50" name="name" value="${resources.name}" data-validate="required:请输入标题" />         
	          <div class="tips"></div>
	        </div>
	      </div> 
	      <div class="form-group">
	        <div class="label">
	          <label>栏目图片：</label>
	        </div>
	        <div class="field">
	          <input type="file" class="button bg-blue margin-right imageflle" id="image1" value="+ 浏览上传"  style="float:left;">
	          <input  onclick="imageAdd()" type="button" class="button bg-blue margin-left shangchuan" value="上传" style="float:left;"/><input type="hidden" id='headimg' name='imageurl'  value="${banner.imageurl}">
	          <div class="tipss">图片尺寸：1920*200</div>
	        </div>
	      </div>
	       <!-- <div class="form-group">
	        <div class="label">
	          <label>英文标题：</label>
	        </div>
	        <div class="field">
	          <input type="text" class="input w50" name="entitle" value="" />         
	          <div class="tips"></div>
	        </div>
	      </div> -->       
	      <div class="form-group">
	        <div class="label">
	          <label>父级按钮：</label>
	        </div>
	        <div class="field">
	          <select name="superGrade">
				  <option value ="0">无</option>
				  	<option value ="${resources.id}">${resources.name}</option>
				</select>         
	        </div>
	      </div> 
	      <div class="form-group">
	        <div class="label">
	          <label>栏目关键字：</label>
	        </div>
	        <div class="field">
	          <input type="text" class="input" name="keyword" value="${resources.keyword}"/>         
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label>关键字描述：</label>
	        </div>
	        <div class="field">
	          <textarea type="text" class="input" name="content" style="height:100px;" >${resources.content}</textarea>        
	        </div>
	     </div>
	    
	     <div class="form-group">
	        <div class="label">
	          <label>显示：</label>
	        </div>
	        <div class="field">
	          <div class="button-group radio">
	              <input name="display" value="0" type="radio" checked="checked">是             
	              <input name="display" value="1"  type="radio">否
	           </div>       
	        </div>
	     </div> 
	     <div class="form-group">
	        <div class="label">
	          <label>是否单页：</label>
	        </div>
	        <div class="field">
	          <div class="button-group radio">
	              <input name="ispage" value="1" type="radio" checked="checked">否           
	              <input name="ispage" value="0"  type="radio">是
	           </div>       
	        </div>
	     </div> 
	     <div class="form-group">
	        <div class="label">
	          <label>排序：</label>
	        </div>
	        <div class="field">
	          <input type="text" class="input w50" name="reserve" value="${resources.reserve=='' || resources.reserve==null ? 0 : resources.reserve}"  data-validate="required:,number:排序必须为数字" />
	          <div class="tips"></div>
	        </div>
	     </div> 
	     <div class="form-group">
	        <div class="label">
	          <label></label>
	        </div>
	        <div class="field">
	          <button class="button bg-main icon-check-square-o" id='submitall' type="submit">提交</button>
	        </div>
	      </div>
	    </form>
	  </div>
	</div>
  </div> 
 </body>
 <script>
	function check(){
		return true;
	}
//上传图片
function imageAdd(){
 		//上传图片
		var fd = new FormData();
			fd.append("upload", 1);
			fd.append("image",$(".imageflle").get(0).files[0]);//id为上传图片的id字符串image应该是后台接收的对象
		$.ajax({
				url: "${ctx}/Upload/image2",
				type: "POST",
				processData: false,
				contentType: false,//禁止ajax识别类型
				data: fd,
				success: function(data) {
					//console.log(d);
					//background:url(icon.jpg) no-repeat left center; width:200px; height:30px;
					if(data!='' && data!=null){
						$(".shangchuan").attr("onclick","");
						$(".shangchuan").val("上传成功","");
						$("input[name='imageurl']").get(0).value=data;
						//$("#imagezhanshi").attr("style","background:url(${ctx}/upload/img/logo.jpg)no-repeat no-repeat center; width:200px; height:30px;");
					}else{
						alert("上传不成功请重新上传");
					}
				}
			});
 	}
	
	
</script>
</html>